package org.bt.common.validator.aspect;


import org.bt.common.constant.CommonConstant;
import org.bt.common.validator.DecimalMinValidatorForCharSequence;
import org.bt.common.validator.number.decimal.*;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * DecimalMin
 * <p>
 * Created on 2020/1/9
 *
 * @author tongw
 */
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(DecimalMin.List.class)
@Documented
@Constraint(
        validatedBy = {
                DecimalMinValidatorForBigDecimal.class,
                DecimalMinValidatorForBigInteger.class,
                DecimalMinValidatorForDouble.class,
                DecimalMinValidatorForFloat.class,
                DecimalMinValidatorForLong.class,
                DecimalMinValidatorForNumber.class,
                DecimalMinValidatorForCharSequence.class,
        }
)
public @interface DecimalMin {

    String message() default CommonConstant.Valid.DECIMAL_MIN;

    String name() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String value();

    boolean inclusive() default true;

    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    public @interface List {
        DecimalMin[] value();
    }
}
